package com.example.javapracticaltraining.entity.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.example.javapracticaltraining.entity.BaseData;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 医护人员绩效评估表
 * @TableName performance_evaluation
 */
@TableName(value ="performance_evaluation")
@Data
public class PerformanceEvaluation implements BaseData {
    /**
     * 评估ID
     */
    @TableId(value = "evaluation_id", type = IdType.AUTO)
    private Integer evaluationId;

    /**
     * 医护人员ID
     */
    @TableField(value = "staff_id")
    private Integer staffId;

    /**
     * 评估月份
     */
    @TableField(value = "evaluation_month")
    private LocalDate evaluationMonth;

    /**
     * 工作时长（小时）
     */
    @TableField(value = "work_hours")
    private Double workHours;

    /**
     * 服务老人数量
     */
    @TableField(value = "elderly_served")
    private Integer elderlyServed;

    /**
     * 工作质量评分（1-5）
     */
    @TableField(value = "quality_score")
    private Integer qualityScore;

    /**
     * 工作效率评分（1-5）
     */
    @TableField(value = "efficiency_score")
    private Integer efficiencyScore;

    /**
     * 团队协作评分（1-5）
     */
    @TableField(value = "teamwork_score")
    private Integer teamworkScore;

    /**
     * 专业技能评分（1-5）
     */
    @TableField(value = "skill_score")
    private Integer skillScore;

    /**
     * 总评分
     */
    @TableField(value = "total_score")
    private Double totalScore;

    /**
     * 评估人
     */
    @TableField(value = "evaluator")
    private String evaluator;

    /**
     * 评估意见
     */
    @TableField(value = "evaluation_comments")
    private String evaluationComments;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private LocalDateTime updateTime;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        PerformanceEvaluation other = (PerformanceEvaluation) that;
        return (this.getEvaluationId() == null ? other.getEvaluationId() == null : this.getEvaluationId().equals(other.getEvaluationId()))
            && (this.getStaffId() == null ? other.getStaffId() == null : this.getStaffId().equals(other.getStaffId()))
            && (this.getEvaluationMonth() == null ? other.getEvaluationMonth() == null : this.getEvaluationMonth().equals(other.getEvaluationMonth()))
            && (this.getWorkHours() == null ? other.getWorkHours() == null : this.getWorkHours().equals(other.getWorkHours()))
            && (this.getElderlyServed() == null ? other.getElderlyServed() == null : this.getElderlyServed().equals(other.getElderlyServed()))
            && (this.getQualityScore() == null ? other.getQualityScore() == null : this.getQualityScore().equals(other.getQualityScore()))
            && (this.getEfficiencyScore() == null ? other.getEfficiencyScore() == null : this.getEfficiencyScore().equals(other.getEfficiencyScore()))
            && (this.getTeamworkScore() == null ? other.getTeamworkScore() == null : this.getTeamworkScore().equals(other.getTeamworkScore()))
            && (this.getSkillScore() == null ? other.getSkillScore() == null : this.getSkillScore().equals(other.getSkillScore()))
            && (this.getTotalScore() == null ? other.getTotalScore() == null : this.getTotalScore().equals(other.getTotalScore()))
            && (this.getEvaluator() == null ? other.getEvaluator() == null : this.getEvaluator().equals(other.getEvaluator()))
            && (this.getEvaluationComments() == null ? other.getEvaluationComments() == null : this.getEvaluationComments().equals(other.getEvaluationComments()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getEvaluationId() == null) ? 0 : getEvaluationId().hashCode());
        result = prime * result + ((getStaffId() == null) ? 0 : getStaffId().hashCode());
        result = prime * result + ((getEvaluationMonth() == null) ? 0 : getEvaluationMonth().hashCode());
        result = prime * result + ((getWorkHours() == null) ? 0 : getWorkHours().hashCode());
        result = prime * result + ((getElderlyServed() == null) ? 0 : getElderlyServed().hashCode());
        result = prime * result + ((getQualityScore() == null) ? 0 : getQualityScore().hashCode());
        result = prime * result + ((getEfficiencyScore() == null) ? 0 : getEfficiencyScore().hashCode());
        result = prime * result + ((getTeamworkScore() == null) ? 0 : getTeamworkScore().hashCode());
        result = prime * result + ((getSkillScore() == null) ? 0 : getSkillScore().hashCode());
        result = prime * result + ((getTotalScore() == null) ? 0 : getTotalScore().hashCode());
        result = prime * result + ((getEvaluator() == null) ? 0 : getEvaluator().hashCode());
        result = prime * result + ((getEvaluationComments() == null) ? 0 : getEvaluationComments().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", evaluationId=").append(evaluationId);
        sb.append(", staffId=").append(staffId);
        sb.append(", evaluationMonth=").append(evaluationMonth);
        sb.append(", workHours=").append(workHours);
        sb.append(", elderlyServed=").append(elderlyServed);
        sb.append(", qualityScore=").append(qualityScore);
        sb.append(", efficiencyScore=").append(efficiencyScore);
        sb.append(", teamworkScore=").append(teamworkScore);
        sb.append(", skillScore=").append(skillScore);
        sb.append(", totalScore=").append(totalScore);
        sb.append(", evaluator=").append(evaluator);
        sb.append(", evaluationComments=").append(evaluationComments);
        sb.append(", createTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append("]");
        return sb.toString();
    }
}